import React from 'react';
import { Menu } from 'antd';
import "./menu.css";
const { SubMenu } = Menu;

export default class Menuchange extends React.Component {
  state = {
    current: "1",
  };

  handleClick =(e)  => {
    this.setState({ current: e.key });
    this.props.hanledClick(e)
  };

  render() {
  
    const { menudata, hanledClick } = this.props;
    const { current } = this.state;
    return (
      <Menu  onClick={this.handleClick} selectedKeys={[current]} mode="horizontal">
        {
          menudata.map((value) => <Menu.Item key={value.key} >
            {value.name}
          </Menu.Item>)
        }
        
      </Menu>
    );
  }
}